﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChangeOrder.aspx.cs" Inherits="Tradier.ChangeOrder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <script type="text/javascript" src="/Contents/js/jquery-1.9.0.js"></script>
    <script type="text/javascript">
        $(function () {
            "use strict";

            $('.order-types').change(function (e) {

                var limitContainer = $('.limit-container'),
                    stopContainer = $('.stop-container'),
                    selectedItemValue = $(this).val();

                limitContainer.hide();
                stopContainer.hide();

                $('input[name=price]', limitContainer).val('');
                $('input[name=stop]', stopContainer).val('');

                switch (selectedItemValue) {
                    case 'limit':
                        limitContainer.show();
                        break;
                    case 'stop':
                        stopContainer.show();
                        break;
                    case 'stop_limit':
                        limitContainer.show();
                        stopContainer.show();
                        break;
                    default:
                        limitContainer.hide();
                        stopContainer.hide();
                        break;
                }
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2>
            Change Order</h2>
        <br />
        <fieldset id="orderFiled">
            <h2>Account: <%= AccountNumber %></h2>
            <div>
                <label for="duration">
                    Duration:
                </label>
                <select name="duration">
                    <option value="day">Day</option>
                    <option value="gtc">GTC</option>
                </select>
            </div>
            <div>
                <label for="type">
                    Order Type:
                </label>
                <select class="order-types" name="type">
                    <option value="market">Market</option>
                    <option value="limit">Limit</option>
                    <option value="stop">Stop</option>
                    <option value="stop_limit">Stop Limit</option>
                </select>
            </div>
            <div class="limit-container" style="display: none;">
                <label for="price">
                    Limit:
                </label>
                <input type="text" name="price" value="" />
            </div>
            <div class="stop-container" style="display: none;">
                <label for="stop">
                    Stop:
                </label>
                <input type="text" name="stop" value="" />
            </div>
            <div>
                <label>
                    &nbsp;
                </label>
                <input type="submit" value="Submit" class="submit" />
            </div>
        </fieldset>
        <p>Status: <%= StatusMessage %></p>
        <p>Error Mesage: <%= ErrorMessage %></p>
    </div>
    </form>
</body>
</html>
